package matlab;

import cli.Logging;

import com.mathworks.toolbox.javabuilder.MWException;


/**
 * Create index files for all images in the image directory
 * Calls Matlab driver for creating the index files
 * @author Peter
 *
 */
public class IndexDir {

	public IndexDir() {

	}

	/**
	 * Create indexes of all images in the source directory <br/>
	 * and place the resulting index files in the index directory
	 * @param imagedir directory of image files
	 * @return indexdir directory of resulting index files
	 */
	public static void createIndex( String imagedir, String indexdir ) { 

		try {
			Logging.log( "Update", "Start Indexing");
			MatlabDriver.getSm().siftdatabase_Java( imagedir, indexdir );			
			Logging.log( "Update", "Finished indexing");
		} catch (MWException e1) {
			Logging.log( "Error", "Failed to create an index for image");
			e1.printStackTrace();
		}catch (Exception e ) {
			e.printStackTrace();
		}
	}
/*
	public static Object[] createIndex( Object[] imgList ) { 
		Object[] objectList = new Object[10];
		try {
			Logging.log( "Update", "Start Indexing");
			MatlabDriver.getSm().siftdatabase_Java( imgList );
			
			Logging.log( "Update", "Finished indexing");
			
		} catch (MWException e1) {
			Logging.log( "Converting", "Failed to create an index for image");
			e1.printStackTrace();
		}
		return objectList;
	}
*/	
}